<template>
  <el-form ref="form" :model="employee" label-width="80px">
    <el-row>
      <el-col :span="8">
        <el-form-item label="姓名">
          <el-input v-model="employee.name"></el-input> </el-form-item
      ></el-col>

      <el-col :span="8">
        <el-form-item label="身份证">
          <el-input v-model="employee.cardNum"></el-input> </el-form-item
      ></el-col>
    </el-row>
    <el-row>
      <el-col :span="8">
        <el-form-item label="性别">
          <el-select v-model="employee.sex" placeholder="性别">
            <el-option label="男" value="1"></el-option>
            <el-option label="女" value="2"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="民族">
          <el-input v-model="employee.race"></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="8">
        <el-form-item label="学历">
          <el-input v-model="employee.education"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="邮箱">
          <el-input v-model="employee.email"></el-input>
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="8">
        <el-form-item label="手机">
          <el-input v-model="employee.phone"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="电话">
          <el-input v-model="employee.tel"></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="8">
        <el-form-item label="政治面貌">
          <el-input v-model="employee.party"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="qq号码">
          <el-input v-model="employee.qqNum"></el-input>
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="8">
        <el-form-item label="联系地址">
          <el-input v-model="employee.address"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="邮政编码">
          <el-input v-model="employee.postCode"></el-input>
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="8">
        <el-form-item label="爱好">
          <el-input v-model="employee.hobby"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="所学专业">
          <el-input v-model="employee.speciality"></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row> </el-row>

    <el-form-item label="备注" style="width: 1000px">
      <el-input type="textarea" v-model="employee.remake"></el-input>
    </el-form-item>

    <el-form-item>
      <el-button type="primary" @click="onSubmit">立即添加</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  name: "AddYuanGong",
  data() {
    return {
      employee: {
        employee_id: "21",
        name: "",
        sex: "",
        phone: "",
        cardNum: "",
        education: "",
        address: "",
        postCode: "",
        tel: "",
        qqNum: "",
        email: "",
        party: "",
        race: "",
        speciality: "",
        hobby: "",
        remake: "",
      },
    };
  },
  methods: {
    onSubmit() {
      console.log("submit!");
      this.$request
        .post("employee-details/insert", this.employee)
        .then((res) => {
          console.log(res);
          if (res.data.obj) {
            this.$message.success("修改成功");
            this.dialogFormVisible = false;
            this.getAllEmployeeDetails();
          } else {
            this.$message.error("修改失败");
          }
        });
    },
  },
};
</script>

<style scoped>
.el-input {
  width: 400px;
}
</style>